define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'expert_review/index',
        add_url: 'expert_review/add',
        edit_url: 'expert_review/edit',
        delete_url: 'expert_review/delete',
        export_url: 'expert_review/export',
        modify_url: 'expert_review/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'service_name', minWidth: 80, title: '用户昵称'},
                    {field: 'sex', title: '性别',selectList: {1: '男',2: '女'}, search: false},
                    {field: 'phone', minWidth: 80, title: '联系电话'},
                    {field: 'wechat_number', minWidth: 80, title: '微信号码'},
                    {field: 'date_ofbirth', minWidth: 80, title: '出生日期', search: false},
                    {field: 'settlein_thecity', minWidth: 80, title: '入驻城市', search: false},
                    {field: 'auditing_status', title: '审核状态',selectList: {0: '待审核',1: '通过',2:"拒绝"}},
                    {field: 'create_time', title: '申请时间',search: false},
                    {title: '操作', templet: function (d) {
                            if(d.auditing_status == 0){
                                return '<button class="layui-btn layui-btn-xs layui-btn-danger" data-open="expert_review/reject_url?id='+d.id+'"  data-title="驳回">驳回</button>' +
                                '<button class="layui-btn layui-btn-xs layui-btn-success" data-request="expert_review/adopt_url?id='+d.id+'"  data-title="确定通过吗？">通过</button>';
                            }else if(d.auditing_status == 1){
                                return '<button class="layui-btn layui-btn-success layui-btn-xs layui-btn-disabled" >已通过</button>';
                            }else if(d.auditing_status == 2){
                                return '<button class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled" >已驳回</button>';
                            }
                        }
                    },
                
                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        reject_url: function () {
            ea.listen();
        }
    };
    return Controller;
});